_require local "../../../../basis.smi"
_require local "../../../../smlformat-lib.smi"
_require local "../../../../smlnj-lib/Util/lib-base.smi"
_require local "../../../data/symbols/main/Loc.smi"
_require local "../../../extensions/debug/main/Bug.smi"
_require local "../../../libs/ids/main/LocalID.smi"
_require local "../../../libs/env/main/SEnv.smi"
_require local "../../../data/symbols/main/Symbol.smi"

_require local "../../../libs/toolchain/main/CoreUtils.smi"
_require local "../../../extensions/usererror/main/UserError.ppg.smi"
_require local "../../../data/control/main/Control.smi"
_require local "../../../compilePhases/parser/main/Parser.smi"
_require local "../../../compilePhases/parser/main/InterfaceParser.smi"
_require local "./InterfaceHash.smi"
_require local "./LoadFileError.ppg.smi"
_require "../../../compilerIRs/absyn/main/AbsynInterface.ppg.smi"
_require "../../../compilerIRs/absyn/main/InterfaceName.ppg.smi"
_require "../../../compilerIRs/absyn/main/Absyn.smi"
_require local "../../../compilerIRs/absyn/main/RequirePath.smi"
_require "../../../libs/toolchain/main/Filename.smi"

structure LoadFile =
struct

  val load
      : {baseFilename : Filename.filename option,
         loadPath : InterfaceName.source list,
         loadMode : InterfaceName.file_load_mode,
         defaultInterface : Filename.filename -> Filename.filename}
        -> Absyn.unit
        -> InterfaceName.file_dependency
           * InterfaceName.toplevel_prelude
           * AbsynInterface.compile_unit

  (* load the given interface files for codes that require them *)
  val loadInterfaceFiles
      : {loadPath : InterfaceName.source list,
         loadMode : InterfaceName.file_load_mode}
        -> InterfaceName.source list
        -> InterfaceName.file_dependency
           * AbsynInterface.interface_unit

  val revisit
      : InterfaceName.file_dependency_root
        -> InterfaceName.file_dependency

end
